package POJO;

import java.io.Serializable;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name = "TYPE_DETAIL")
public class TypeDetail implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = -1620019750039375756L;

	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	@Column(name = "Type_Detail_Id")
	private int typeDetailId;
	
	@Column(name = "Type_Detail_Name")
	private String typeDetailName;
	
	@ManyToOne()
	@JoinColumn(name = "Type_Id")
	private Type type;
	
	@ManyToMany(fetch = FetchType.LAZY, mappedBy = "typeDetails")
	private Set<ProductDetail> productDetails;

	public TypeDetail() {
		super();
	}

	public TypeDetail(String typeDetailName, Type type) {
		super();
		this.typeDetailName = typeDetailName;
		this.type = type;
	}

	public TypeDetail(String typeDetailName, Type type,
			Set<ProductDetail> productDetails) {
		super();
		this.typeDetailName = typeDetailName;
		this.type = type;
		this.productDetails = productDetails;
	}

	public int getTypeDetailId() {
		return typeDetailId;
	}

	public void setTypeDetailId(int typeDetailId) {
		this.typeDetailId = typeDetailId;
	}

	public String getTypeDetailName() {
		return typeDetailName;
	}

	public void setTypeDetailName(String typeDetailName) {
		this.typeDetailName = typeDetailName;
	}

	public Type getType() {
		return type;
	}

	public void setType(Type type) {
		this.type = type;
	}

	public Set<ProductDetail> getProductDetails() {
		return productDetails;
	}

	public void setProductDetails(Set<ProductDetail> productDetails) {
		this.productDetails = productDetails;
	}
}




